<?php
  class Plugins_Texteditor extends model {
  
  
  
  function getformadd($productid="")
  {
  

  
  $echo=1;

  
 // $attrarray['class']="inpAddCtntNoBd w616 frmTxtPlg clBg5 fs03 clTxt2";
//  $attrarray['placeholder']="Click here to put some text and explain everything !!";
 // $textbox2=new Element_Textarea("", "text[]",$attrarray);
  //$strenddate=$textbox2->render($echo);
//  
  $strenddate='<textarea name="texteditor[]" placeholder="Click here to put some text and explain everything !!" class="inpAddCtntNoBd w616 frmTxtPlg clBg5 fs03 clTxt2" ></textarea>';
  

  
  $str='<div class="wrpPlg clBg5 clBd2 bdFull classtext">
                    <div class="wrpOutAtcPlg">
                        <div class="wrpAtcPlg">
                            <span class="ico icoOri icoTxtPlg"></span>
                            <div class="spnAtcPlg clTxtW">
                                <span class="txtAtcPlg fs03">TextEditor</span>
                            </div>
                        </div>
                    </div>
                    <div class="wrpTl">
                        <div title="Close" class="btnIco closeTl clBd3 mgBtm10 deleterowbutton">
                            <span class="ico icoOri icoCloseTl"></span>
                        </div>
                    </div>
                    
                        '.$strenddate.'
                    
                </div>';
  
  
  $arraydata['form']=addslashes(str_replace(array("\r", "\n", "\r"), '', $str));
  //$arraydata['js'][]=pluginjsinfo.'/text.js';


  
  
      
  
  
  
  return $arraydata;
  
  
  
  
  
  
  
  }
  
  function getformlanding($arraydata)
  {
  if($arraydata['html'])
  {
  
  $code  = '<div class="ldIt wrpTxtLd clBg4">'."";
  $code .= '<p>'.$arraydata['html'] .'</p>'."";
  $code .= '</div>';
  }else
  {
  $code="";
  }
 
   $data['str']=$code;
   $data['target']='secondtarget';
  
  return $data; 
  
  }
  
  function getplugin($plugreid)
  {
  
     
    
     $sql="select * from tb_plugins_texteditor where plugreid=".$plugreid;
     $arrayplugin=$this->db->db_set_1recordrow($sql);
     //$parser = new \SBBCodeParser\Node_Container_Document();
    // $parser = new JBBCode\Parser();
   //  $parser->addCodeDefinitionSet(new JBBCode\DefaultCodeDefinitionSet());
     
    
     
     $arrayplugin['html']=bbcode_to_html($arrayplugin['text']);
     $arrayplugin['text']=bbcode_to_html($arrayplugin['text']);
  //$arrayplugin['html']=$parser->parse($arrayplugin['html'])->get_html();

  
     return $arrayplugin;

  
  
  

  
  }
  
  function saveplugin($arraydata,$productid,$plugreid)
  {
  $arraydata['productid']=$productid;
  $arraydata['plugreid']=$plugreid;
  $this->db->db_set($arraydata,'tb_plugins_texteditor');
  
  }
 
  
  
  }
?>
